package com.example.baiduapi.Util;

/**
 * 拼音加密汉字
 */
public class PyEncrypt {
    private static String[] strPY = new String[]{"阿", "波", "吃", "得", "额", "佛", "鸽", "呵", "伊", "基", "科", "勒", "么", "讷", "倭", "坡", "妻", "日", "嘶", "特", "屋", "微", "午", "希", "已", "兹"};
    public static String encrypt(String chinese) {
        String temp = "";
        String encryptChinese = Pyutil.toPinyin(chinese);
        String[] strArray = encryptChinese.split("");
        for (int i = 0; i < strArray.length; i++) {
            switch (strArray[i]) {
                case "a":
                    temp += strPY[0];
                    break;
                case "b":
                    temp += strPY[1];
                    break;
                case "c":
                    temp += strPY[2];
                    break;
                case "d":
                    temp += strPY[3];
                    break;
                case "e":
                    temp += strPY[4];
                    break;
                case "f":
                    temp += strPY[5];
                case "g":
                    temp += strPY[6];
                    break;
                case "h":
                    temp += strPY[7];
                    break;
                case "i":
                    temp += strPY[8];
                    break;
                case "j":
                    temp += strPY[9];
                    break;
                    case "k":
                    temp += strPY[10];
                    break;
                case "l":
                    temp += strPY[11];
                    break;
                case "m":
                    temp += strPY[12];
                    break;
                case "n":
                    temp += strPY[13];
                    break;
                case "o":
                    temp+= strPY[14];
                    break;
                    case "p":
                    temp += strPY[15];
                    break;
                case "q":
                    temp += strPY[16];
                    break;
                case "r":
                    temp += strPY[17];
                    break;
                case "s":
                    temp += strPY[18];
                    break;
                case "t":
                    temp += strPY[19];
                    break;
                case "u":
                    temp += strPY[20];
                    break;
                case "v":
                    temp += strPY[21];
                    break;
                case "w":
                    temp += strPY[22];
                    break;
                    case "x":
                    temp += strPY[23];
                    break;
                case "y":
                    temp += strPY[24];
                    break;
                case "z":
                    temp += strPY[25];
                    break;
            }

        }
        return temp;
    }
    public static void main(String[] args) {
        System.out.println(encrypt("张三"));
    }

}